// 时间转换, 完整程序

#include <iostream>
using namespace std;

int main() {
    int choice;
    int hour;
    int min;
    int sec;
    int totalSec;
    char colon;

    do {
        cout << "\n1 = 转换 时:分:秒 到 秒\n"
            << "2 = 转换 秒 到 时:分:秒\n"
            << "3 = 退出\n"
            << "请选择: ";

        cin >> choice;
        switch (choice) {
            case 1:
                cout << "输入 时:分:秒, 格式如3:26:33: ";
                cin >> hour >> colon >> min >> colon >> sec;
                totalSec = hour * 3600 + min * 60 + sec;
                cout << "以秒为单位的时间是 " << totalSec << "\n";
                break;

            case 2:
                cout << "输入秒钟数, 如3440: ";
                cin >> totalSec;
                hour = totalSec / 3600;
                min = totalSec / 60 - hour * 60;
                sec = totalSec % 60;
                cout << "时间是 " << hour << ":" << min << ":" << sec << "\n";
                break;

            case 3:
                cout << "你输入了3(程序将退出)\n";
                break;

            default:
                cout << "我不能处理这个选项，请重新选择。\n";
                break;
        }
    } while (choice != 3);

    cout << "再见\n";
}